﻿@model VehicleOOBWeb.Models.Order

@{
    VehicleOOBWeb.Models.Personallnfo personalInfo = ViewBag.PersonalInfo as VehicleOOBWeb.Models.Personallnfo;
    ViewBag.Title = "Thanh toán hóa đơn mua hàng";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<style>
    table {
    }

        table tr {
            height: 27px;
        }


            table tr .editor-label {
                width: 120px;
                border-right: solid 1px blue;
            }

            table tr .editor-field {
                padding-left: 5px;
            }
</style>
<h2>Thanh toán hóa đơn mua hàng</h2>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
   
    <table style="width: 100%">
        <tr>
            <td class="editor-label">Người mua hàng:
            </td>
            <td class="editor-field">@(personalInfo.first_name + " " + personalInfo.last_name) 
                <input type="hidden" name="username" value="@personalInfo.username" />
            </td>
        </tr>
        <tr>
            <td class="editor-label">Địa chỉ:
            </td>
            <td class="editor-field">@personalInfo.address</td>
        </tr>
        <tr>
            <td class="editor-label">CMND số:
            </td>
            <td class="editor-field">@personalInfo.id_number</td>
        </tr>
        <tr>
            <td class="editor-label">Điện thoại:
            </td>
            <td class="editor-field">@personalInfo.phone</td>
        </tr>
        <tr>
            <td class="editor-label">Ngày hóa đơn
            </td>
            <td class="editor-field">
                @DateTime.Now.ToString("dd/MM/yyyy HH:mm")
                <input type="hidden" name="received_date" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm")" />
            </td>
        </tr>
        <tr>
            <td class="editor-label">Ngày chuyển hàng</td>
            <td class="editor-field">
                @Html.TextBoxFor(model => model.shipped_date)
            </td>
        </tr>
        <tr>
            <td colspan="2" class="editor-error">
                @Html.ValidationMessageFor(model => model.shipped_date)
            </td>
        </tr>
        <tr>
            <td colspan="2">Chi tiết hóa đơn</td>
        </tr>
    </table>
    
    <table class="tbInherit">
        <tr>
            <th>Tên</th>
            <th>Hãng Xe</th>
            <th>Giá</th>
            <th>Số lượng</th>
            <th></th>
        </tr>
        @if (ViewBag.Carts != null)
        {
            foreach (var item in ViewBag.Carts)
            {
            <tr id="tr_vid_@item.item_id">
                <td>
                    @item.item_name
                </td>
                <td>
                    @item.item_manufacturer
                </td>
                <td>
                    @item.item_price
                </td>
                <td>@item.item_quantity
                </td>
                <td>
                    <a href="javascript:vehicle_cart.removeOutCart('@item.item_id')" >
                        <img src='/Images/icon-del.png' alt='del' />
                    </a>
                </td>
            </tr>
            }
        }
        else
        { 
            <tr>
                <td colspan="6" style="text-align: center">Hiện giỏ hàng đang rỗng</td>
            </tr>     
        }
    </table>

    <p>
        <input type="submit" value="Thanh toán" />
    </p>
}


@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
